package rs.fon.is.music.domain;


import java.util.Collection;
import java.util.LinkedList;

import rs.fon.is.music.util.Constants;
import thewebsemantic.Namespace;
import thewebsemantic.RdfProperty;
import thewebsemantic.RdfType;

@Namespace(Constants.SCHEMA)
@RdfType("MusicRecording")
public class MusicRecording extends Thing {

	@RdfProperty(Constants.SCHEMA + "interactionCount")
	private String interactionCount;

	@RdfProperty(Constants.SCHEMA + "keywords")
	private Collection<String> keywords;

	@RdfProperty(Constants.SCHEMA + "byArtist")
	private MusicGroup artist;

	@RdfProperty(Constants.SCHEMA + "inAlbum")
	private MusicAlbum album;
	
	public MusicRecording() {
		this.keywords = new LinkedList<>();
	}

	public String getInteractionCount() {
		return interactionCount;
	}

	public void setInteractionCount(String interactionCount) {
		this.interactionCount = interactionCount;
	}

	public MusicAlbum getAlbum() {
		return album;
	}

	public void setAlbum(MusicAlbum album) {
		this.album = album;
	}

	public Collection<String> getKeywords() {
		return keywords;
	}

	public void setKeywords(Collection<String> keywords) {
		this.keywords = keywords;
	}
	
	public void addKeyword(String keyword){
		this.keywords.add(keyword);
	}

	public MusicGroup getArtist() {
		return artist;
	}

	public void setArtist(MusicGroup artist) {
		this.artist = artist;
	}

	@Override
	public String toString() {
		
		String keywordsString = "";
		for (String keyword : keywords) {
			keywordsString += " " + keyword + ",";
		}
		if(!keywordsString.isEmpty())
			keywordsString = keywordsString.substring(0, keywordsString.length()-1);
		
		return "Music recording: " + getName() 
				+ "\nURI: " + getUri()
				+ "\nURL: " + getUrl() 
				+ "\ninteraction count: "+ getInteractionCount() 
				+ "\nkeywords: " + keywordsString
				+ "\ninAlbum: " + getAlbum().getName()
				+ "\nbyArtist: " + getArtist().getName();
	}

}
